{% extends "base.html" %}
{% load i18n %}
<body>
{% block detail %}

    <div class="main">
        <div class="login register">
            <h2>{% trans 'Input new password' %}</h2>

            <form action="/newpass/" id="changePassForm" method="post" class="nice" action="create">{% csrf_token %}
                <div id="error_message" class="worn">
                    {% if error %}
                        {{ error }}
                    {% endif %}
                </div>
                <div id="validate" class="worn"></div>
                <dl class="clearfix">
                    <dt>{% trans 'Password' %}：</dt>
                    <input name="password" id="password" type="password" class="text"/>
                </dl>
                <dl class="clearfix">
                    <dt>{% trans 'Confirm password' %}：</dt>
                    <input name="confirmPassword" id="confirmPassword" type="password" class="text"/>
                </dl>
                <div class="btnLine"><input type="button" onclick="check()" value="{% trans 'Submit' %}"/></div>
            </form>
        </div>
    </div>

{% endblock %}
{% block js %}
    <script>
        function check() {

            if ($("#password").val() == '') {
                $("#validate").empty();
                $("#validate").html("密码为必需项!");
                return false;
            }
            if ($("#confirmPassword").val() == '') {
                $("#validate").empty();
                $("#validate").html("密码确认为必需项!");
                return false;
            }
            if ($("#password").val() != $("#confirmPassword").val()) {
                $("#validate").empty();
                $("#validate").html("密码及密码确认必须相同!");
                return false;
            }
            $("#changePassForm").submit();
        }
    </script>
{% endblock %}
</body>
</html>